Component({
    externalClasses: [ "custom-bar", "custom-box", "custom-panel" ],
    properties: {
        customStyle: String,
        tabs: {
            type: Array,
            value: []
        },
        index: {
            type: Number,
            value: -1,
            observer: function(t) {
                /^\d{1,}$/.test(t) && (this.data.activeIndex === t ? this.setData({
                    activeIndex: +t
                }) : this.emit(+t));
            }
        }
    },
    data: {
        activeIndex: 0
    },
    ready: function() {
        this.emit(this.data.activeIndex);
    },
    methods: {
        tab: function(t) {
            var e = t.currentTarget.dataset.index;
            this.emit(e);
        },
        emit: function(t) {
            var e = this;
            this.setData({
                activeIndex: t
            }, function() {
                e.triggerEvent("change", {
                    index: t
                }, {});
            });
        }
    }
});